#include <cstdio>
void hano(int n, char a, char b, char c) //move from a to c, tower b is auxiliary tower
{
    if (1 == n)
    {
        printf("move from %c to %c\n", a, c);
    }
    else
    {
        hano(n - 1, a, c, b);
        printf("move from %c to %c\n", a, c);
        hano(n - 1, b, a, c);
    }
}
int main()
{
    int n;
    scanf("%d", &n);
    char a = 'a', b = 'b', c = 'c';
    hano(n, a, b, c);
}